<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>购物车</title>
	<link rel="stylesheet" type="text/css" href="./Public/Home/css/shop.css"/>
	<script src="./Public/Home/js/jquery.min1.9.js" type="text/javascript" charset="utf-8"></script>
	<script src="./Public/Home/js/index.js" type="text/javascript" charset="utf-8"></script>
    <script>
        $(function(){
            $('.minus').click(function () {
                var num=parseInt($(this).siblings(".number").val())||0;
                num=num-1;
                num=num<1?1:num;
                $(this).siblings(".number").val(num);
                var data = {};
                data.id = $(this).attr('id');
                data.nums = $(this).siblings(".number").val();
                $.ajax({
                    type:"post",
                    url:"{{U('Cart/idet')}}",
                    data:data,
                    dataType:"text",
                    success:function (phpData) {
                        $('.g .buy-menu .cart-fee ul .cart-fee-data1').html(phpData);
                        num = 0;
                        for(i=0;i<$('.number').length;i++){
                            num = Number($('.number').eq(i).val()) + Number(num);
                        }
                        $('.main-content .wrapper .brick-bottom .g .buy-menu .cart-fee ul .cart-fee-data').html(num);
                    }
                })

            })
            $('.plus').click(function () {
                var num=parseInt($(this).siblings(".number").val())||0;
                $(this).siblings(".number").val(num+1);
                var data = {};
                data.id = $(this).attr('id');
//                alert(data.id);
                data.nums = $(this).siblings(".number").val();
                $.ajax({
                    type:"post",
                    url:"{{U('Cart/idet')}}",
                    data:data,
                    dataType:"text",
                    success:function (phpData) {
                        $('.g .buy-menu .cart-fee ul .cart-fee-data1').html(phpData);
                        num = 0;
                        for(i=0;i<$('.number').length;i++){
                            num = Number($('.number').eq(i).val()) + Number(num);
                        }
                        $('.main-content .wrapper .brick-bottom .g .buy-menu .cart-fee ul .cart-fee-data').html(num);
                    }
                })
            })

        })
    </script>
    <script>
        $(function () {

        })
    </script>

</head>
<body>
	<!--头部条开始-->
	{{include file="../Common/header"}}
	<!--导航区域结束-->
	<div class="main-content ">
		<div class="wrapper">
			<ul class="breadcrumb">
				<li>
					<a href="">首页</a>
					<span>/</span>
				</li>
				<li>
					购物车
				</li>
			</ul>
			<div class="brick-bottom">
				<ul class="steps">
					<li class="one">
						<div class="step-content">
							<h5 class="step-heading">购物车</h5>
							<div class="step-gradient"></div>
						</div>
					</li>
					<!--<div class="after"></div>-->
					
					<li class="two">
						<div class="step-content">
							<h5 class="step-heading">填写账单</h5>
							<div class="step-gradient"></div>
						</div>
					</li>
<!--					<div class="after"></div>-->

					<li class="there">
						<div class="step-content">
							<h5 class="step-heading">填写账单</h5>
							<div class="step-gradient"></div>

						</div>
					</li>
					<div class="after"></div>
				</ul>
				<form action="" method="post" class="g">
					<ul class="purchase-list-header">
						<li class="first">

								<span class="all">
									商品信息
								</span>
						</li>
						<li class="second">产品</li>
						<li class="third">数量</li>
						<li class="four">单价</li>
						<li class="five">操作</li>
					</ul>
					
					<h2 class="buy-menu">
                        {{if value="!empty($_SESSION['cart']['goods'])"}}
                            {{foreach from="$_SESSION['cart']['goods']" key="$k" value="$v"}}
                                <div class="details">
                                <div class="cart-product-choice">
                                    <a href="" class="cart-product-image">
                                        <img src="./Public/Home/images/shouji1.jpg" style="width: 104px;height: 120px;"/>
                                    </a>
                                </div>
                                <div class="cart-product-info">
                                    <div class="cart-product-description">
                                        <h3 class="heading">
                                            <a href="">{{$v['name']}}</a>
                                            {{foreach from="$v['options']['type']"  value="$value"}}
                                                <p class="p">{{$value}}</p>
                                            {{endforeach}}
                                        </h3>
                                    </div>


                                    <div class="lap-one">
                                        <div class="wrapper">
                                            <div class="counter-box">
                                                <a  href="javascript:;" id="{{$k}}"class="minus" style="color: black;">-</a>
                                                <input type="text" value="{{$v['num']}}" class="number" />
                                                <a href="javascript:;" id="{{$k}}" class="plus" style="color: black;">+</a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="cart-product-price">
                                        {{if value="!empty($v['options']['oldPrice'])"}}
                                            <span class="reduced" style="font-size: 18px;">￥{{$v['options']['oldPrice']}}</span>
                                        {{endif}}
                                        <strong style="font-size: 18px;">￥{{$v['price']}}</strong>
                                        <br />
                                        <span class="icon-reduced">官网促销</span>
                                    </div>
                                    <div class="del">
                                        <a href="{{U('Cart/index',array('del'=>$k))}}" class="delete" style="font-size: 18px;color: black;">删除</a>
                                    </div>
                                </div>
                            </div>
                            {{endforeach}}
                        {{else}}
                            <div class="null" style="margin-left: 386px;padding-top: 20px;padding-bottom:20px;font-size: 32px;">购物车是空的，去<a href="{{U('Index/index')}}"style="color: #1f8657;">逛逛</a>吧</div>
                        {{endif}}
                        {{if value="!empty($_SESSION['cart']['goods'])"}}
                            <div class="cart-fee">

                                    <ul>
                                        <li>
                                            <span class="cart-fee-title">
                                                商品数量：
                                            </span>
                                            <span class="cart-fee-data">{{Cart::getTotalNums()}}</span>
                                        </li>

                                        <li>
                                            <span class="cart-fee-title">
                                                小计：
                                            </span>
                                            <span class="cart-fee-data1">{{ Cart::getTotalPrice();}}</span>
                                        </li>
                                    </ul>


                            </div>
                        {{endif}}
						<div class="form-actions">
							<div class="form-actions-left">
								<a href="{{U('List/index')}}">继续购买>></a>
							</div>
							<div class="form-actions-right">
                                {{if value="!empty($_SESSION['cart']['goods'])"}}
                                    <button class="jiesuan">
                                        {{if value="!isset($_SESSION['username'])"}}
                                            <a href="{{U('Login/index')}}">结算</a>
                                        {{else}}
                                            <a href="{{U('From/index')}}">结算</a>
                                        {{endif}}
                                    </button>
                                {{endif}}

                            </div>
						</div>
					</div>

				</form>
			</div>
		</div>

	</div>
    <!--公共底部-->
    {{include file="../Common/footer"}}
	

	

	
	



</body>
</html>